<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" class="uk-height-1-1">
<head>
    <meta charset="utf-8"/>
    <title>Knovia 验证中心登陆</title>
    <link rel="stylesheet"  th:href="@{/css/reset.css}"/>
    <link rel="stylesheet" th:href="@{/css/common.css}"/>
    <link rel="stylesheet" th:href="@{/css/font-awesome.min.css}"/>
</head>

<body>

<div class="wrap login_wrap">
    <div class="content">
        <div class="logo"></div>
        <div class="login_box">

            <div class="login_form">
                <div class="login_title">
                    Knovia登录
                </div>
                <p class="uk-text-danger" style="font-size: large" th:if="${param.error}">
                    登录失败 ...
                </p>

                <p class="uk-text-success" th:if="${param.logout}">
                    账号已登出.
                </p>

                <form method="post" th:action="@{/authentication/form}">
                <div class="form_text_ipt">
                    <input name="username" type="text" placeholder="手机号/邮箱" value="admin"/>
                </div>
                <div class="ececk_warning"><span>手机号/邮箱不能为空</span></div>
                <div class="_warning"><span>${message!''}</span></div>
                <div class="form_text_ipt">
                    <input name="password" type="password" placeholder="密码" value="123456"/>
                </div>
                <div class="ececk_warning"><span>密码不能为空</span></div>
                <div class="form_text_ipt">
                    <input style="width: 150px;" name="imageCode" type="text" placeholder="验证码" onkeydown="keyDown()"/>
                    <img src="/code/image" onclick="javascript:this.src='/code/image?random='+Math.random()"/>
                </div>
                <div class="ececk_warning"><span>验证码不能为空</span></div>
                <div class="_warning"><span id="span_msg"></span></div>
                <div class="form_check_ipt">
                    <div class="left check_left">
                        <label><input name="remember-me" type="checkbox"/> 下次自动登录</label>
                    </div>
                    <div class="right check_right">
                        <a href="#">忘记密码</a>
                    </div>
                </div>
                <div class="form_btn">
                    <button id="login">登录</button>
                </div>
                </form>
                <div class="form_reg_btn">
                    <span>还没有帐号？</span><a href="/register">马上注册</a>
                </div>
                <div class="other_login">
                    <div class="left other_left">
                        <span>其它登录方式</span>&nbsp;&nbsp;<a href="/authentication/mobilePage">短信登录</a>
                    </div>
                    <div class="right other_right">
                        <a th:href="@{/login/qq}" ><i class="fa fa-qq fa-2x"></i></a>
                        <a th:href="@{/login/weixin}" ><i class="fa fa-weixin fa-2x"></i></a>
                        <a th:href="@{/login/weibo}"><i class="fa fa-weibo fa-2x"></i></a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script>
    $(function () {
    //     $("#login").click(function () {
    //         //判断是否勾选记住我
    //         var isCheck = $("input[name='remember-me']").is(":checked");
    //         $.ajax({
    //             url: "/authentication/form",
    //             type: "post",
    //             async: true,
    //             data: {
    //                 "username": $("input[name='username']").val(),
    //                 "password": $("input[name='password']").val(),
    //                 "imageCode": $("input[name='imageCode']").val(),
    //                 "remember-me": isCheck
    //             },
    //             dataType: "json",
    //             contentType: "application/x-www-form-urlencoded",
    //             success: function (data) {
    //                 if (data.code === -2 || data.code === 103) {
    //                     $("#span_msg").text(data.msg);
    //                 } else {
    //                     window.location.href = data.data.replace("192.168.16.31","auth.knovia.cn");
    //                 }
    //             },
    //             error: function (XMLHttpRequest, textStatus, errorThrown) {
    //                 alert(XMLHttpRequest.status);
    //                 alert(XMLHttpRequest.readyState);
    //                 alert(textStatus); // paser error;
    //
    //                 if(textStatus == "parsererror"){
    //                     window.location.href = "http://auth.knovia.cn/authentication/require?error";
    //                 }
    //             }
    //
    //         })
    //         ;
    //     });
    //
    // });

    function keyDown() {
        if (event.keyCode == 13) {
            event.returnValue = false;
            event.cancel = true;
            $("#login").click();
        }
    }
</script>
</body>
</html>